#ifndef BOUNDINGBOX_H
#define BOUNDINGBOX_H

#include "vecmath.h"

class BoundingBox
{
public:
    BoundingBox();
    BoundingBox(Vec3f min, Vec3f max);
    BoundingBox(const BoundingBox& in);
    
    BoundingBox& operator=(const BoundingBox& in);
    
    float width() const { return (max[0] - min[0]); }
    float height() const { return (max[1] - min[1]); }
    float depth() const { return (max[2] - min[2]); }
    
	void getCenter(Vec3f out);
	void getLeftCenter(Vec3f out);
	void getRightCenter(Vec3f out);
    
    bool isPlane() const { return (min[2] == max[2]); }
    bool contains(Vec3f point) const { return (min[0] <= point[0]) && (point[0] <= max[0]) && (min[1] <= point[1]) && (point[1] <= max[1]) && (min[2] <= point[2]) && (point[2] <= max[2]); }
    
    void merge(const BoundingBox& in);
	
	void translate(Vec3f displacement);
	void scale(Vec3f scaleFactors);
	
	void inset(Vec3f in);
	void inset(float x, float y, float z);
	
	void setWidth(float w) { max[0] = min[0] + w; }
	
public:
    Vec3f min;
    Vec3f max;
};

#endif // BOUNDINGBOX_H
